package com.yan.demo;

import java.util.Arrays;

public class Test12 {
    public static void main(String[] args) {
        int[] arr = {95, 92, 75, 56, 98, 71, 80, 58, 91, 91};
        arr = adjustPosition(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static int[] adjustPosition(int[] arr) {
        // 冒泡
        for (int i = 0; i < arr.length; i++) {
            for (int j = 1; j < arr.length - i; j++) {
                if (arr[j - 1] % 2 == 0) {
                    int temp = arr[j - 1];
                    arr[j - 1] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        return arr;
    }
}
